using System;
using System.Drawing;
using System.Windows.Forms;
using MouseKeyboardOperationSimulator;

public class ThemeComparisonVisual : Form
{
    private ThemeManager defaultTheme;
    private ThemeManager lightTheme;
    private ThemeManager darkTheme;
    
    private Panel defaultPanel;
    private Panel lightPanel;
    private Panel darkPanel;
    
    private Label defaultLabel;
    private Label lightLabel;
    private Label darkLabel;
    
    private Button defaultButton;
    private Button lightButton;
    private Button darkButton;
    
    public ThemeComparisonVisual()
    {
        InitializeComponent();
        LoadThemes();
        DisplayThemeColors();
    }
    
    private void InitializeComponent()
    {
        this.Text = "主题颜色对比";
        this.Size = new Size(800, 600);
        this.StartPosition = FormStartPosition.CenterScreen;
        
        // 创建面板用于显示主题
        defaultPanel = new Panel();
        defaultPanel.Location = new Point(10, 10);
        defaultPanel.Size = new Size(250, 500);
        defaultPanel.BorderStyle = BorderStyle.FixedSingle;
        
        lightPanel = new Panel();
        lightPanel.Location = new Point(270, 10);
        lightPanel.Size = new Size(250, 500);
        lightPanel.BorderStyle = BorderStyle.FixedSingle;
        
        darkPanel = new Panel();
        darkPanel.Location = new Point(530, 10);
        darkPanel.Size = new Size(250, 500);
        darkPanel.BorderStyle = BorderStyle.FixedSingle;
        
        // 添加面板到窗体
        this.Controls.Add(defaultPanel);
        this.Controls.Add(lightPanel);
        this.Controls.Add(darkPanel);
    }
    
    private void LoadThemes()
    {
        defaultTheme = new ThemeManager(BuiltInTheme.Default);
        lightTheme = new ThemeManager(BuiltInTheme.Light);
        darkTheme = new ThemeManager(BuiltInTheme.Dark);
    }
    
    private void DisplayThemeColors()
    {
        DisplayTheme(defaultPanel, defaultTheme, "默认主题");
        DisplayTheme(lightPanel, lightTheme, "明亮主题");
        DisplayTheme(darkPanel, darkTheme, "暗色主题");
    }
    
    private void DisplayTheme(Panel panel, ThemeManager theme, string themeName)
    {
        // 清空面板内容
        panel.Controls.Clear();
        
        // 添加主题名称标签
        Label nameLabel = new Label();
        nameLabel.Text = themeName;
        nameLabel.Font = new Font(nameLabel.Font, FontStyle.Bold);
        nameLabel.Location = new Point(10, 10);
        nameLabel.Size = new Size(200, 20);
        nameLabel.BackColor = theme.GetColor("background");
        nameLabel.ForeColor = theme.GetColor("textPrimary");
        panel.Controls.Add(nameLabel);
        
        // 显示主要颜色
        int yPos = 40;
        string[] colorNames = { "primary", "secondary", "success", "warning", "danger", "info", "background", "textPrimary" };
        
        foreach (string colorName in colorNames)
        {
            try
            {
                Color color = theme.GetColor(colorName);
                
                Panel colorPanel = new Panel();
                colorPanel.Location = new Point(10, yPos);
                colorPanel.Size = new Size(200, 30);
                colorPanel.BorderStyle = BorderStyle.FixedSingle;
                colorPanel.BackColor = color;
                
                Label colorLabel = new Label();
                colorLabel.Text = $"{colorName}: {color.Name}";
                colorLabel.Location = new Point(10, yPos + 35);
                colorLabel.Size = new Size(200, 15);
                colorLabel.BackColor = theme.GetColor("background");
                colorLabel.ForeColor = theme.GetColor("textPrimary");
                
                panel.Controls.Add(colorPanel);
                panel.Controls.Add(colorLabel);
                
                yPos += 60;
            }
            catch (Exception ex)
            {
                Label errorLabel = new Label();
                errorLabel.Text = $"Error: {ex.Message}";
                errorLabel.Location = new Point(10, yPos);
                errorLabel.Size = new Size(200, 15);
                panel.Controls.Add(errorLabel);
                yPos += 20;
            }
        }
    }
    
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new ThemeComparisonVisual());
    }
}